<?php
include_once("functions/is_login.php");
if (!session_id()){//这里使用session_id()判断是否已经开启了Session
	session_start();
}
if(!is_login()){
	echo "请您登录系统后，再访问该页面！";
	return;
}
?>
<?php
include_once("functions/database.php");
include_once("functions/page.php");
$sql = "select * from review";
$data_conn = get_connection();
//分页的实现
$result_news = mysqli_query($data_conn,$sql);
$total_records = mysqli_num_rows($result_news);
$page_size = 3;
if(isset($_GET["page_current"])){
	$page_current = $_GET["page_current"];
}else{
	$page_current = 1;
}
$start = ($page_current-1)*$page_size;
$result_sql = "select * from review order by review_id desc limit $start,$page_size";
$result_set = mysqli_query($data_conn,$result_sql);
close_connection();
echo "新闻发布系统的所有评论信息如下：<br/>";
while(($row = mysqli_fetch_array($result_set)) != 0){
	echo "评论内容：".$row["content"]."<br/>";
	echo "日期：".$row["publish_time"]."&nbsp;&nbsp;";
	echo "IP地址：".$row["ip"]."&nbsp;&nbsp;";
	echo "状态：".$row["state"]."<br/>";
	echo "<a href='review_delete.php?review_id=".$row["review_id"]."'>删除</a>";
	echo "&nbsp;&nbsp;&nbsp;";
	if($row["state"]=="未审核"){
		echo "<a href='review_verify.php?review_id=".$row["review_id"]."'>审核</a>";
	}
	echo "<hr/>";
}
//分页的实现
$url = "index.php?url=review_list.php";
page($total_records,$page_size,$page_current,$url,"");
?>
